package com.ys.service.log.impl;

import com.ys.entity.business.TsApiLog;
import com.ys.mapper.business.TsApiLogMapper;
import com.ys.service.log.ApiLogService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;
import java.util.UUID;

@Service("apiLogService")
public class ApiLogServiceImpl implements ApiLogService {

    @Autowired
    private TsApiLogMapper tsApiLogMapper;

    @Override
    public int addApiLog(String system, String type, String input, String output, int code, String message) {
        int result = 0;
        try {
            TsApiLog apiLog = new TsApiLog();
            apiLog.setSystem(system);
            apiLog.setType(type);
            apiLog.setInput(input);
            apiLog.setOutput(output);
            apiLog.setCode(code);
            apiLog.setMessage(message);
            apiLog.setStatus(0);
            tsApiLogMapper.insert(apiLog);
        }catch (Exception ex){
            ex.printStackTrace();
        }
        return result;
    }
}
